/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Microsoft
 * Date: 2022-11-07
 * Time: 12:26
 */
public class Test {
    public static void main(String[] args) {
        int a = 1;
        do {
            System.out.println(a);
            a++;
        } while (a <= 10);
    }




    public static void main13(String[] args) {
        for (int i = 0; true ; i++) {
            System.out.println(1);
        }
    }




    public static void main12(String[] args) {
        int fac = 1;
        int sum = 0;
        for (int i = 1; i <= 5 ; i++) {
            fac *= i;
            sum += fac;
        }
        System.out.println(sum);
    }


    public static void main11(String[] args) {
        //fori 回车
        for (int i = 1; i <= 10; i++) {
            System.out.println(i);
        }
    }
    //-------------
    //编译器运行结果为
    //1
    //2
    //3
    //4
    //5
    //6
    //7
    //8
    //9
    //10





    public static void main10(String[] args) {
        int a = 1;
        while (a <= 100) {
            if(a % 3 == 0 && a % 5 == 0){
                System.out.println(a);
            }else{
                a += 1;
                continue;
            }
            a += 3;
        }
    }
    //-------------
    //编译器运行结果为
    //15
    //30
    //45
    //60
    //75
    //90


    public static void main9(String[] args) {
        int a = 1;
        while (a <= 3) {
            System.out.println(a);
            if(a == 2){
                continue;
            }
            a++;
        }
    }

    public static void main8(String[] args) {
        int a = 10;
        while (true) {
            System.out.println(a);
        }
    }


    public static void main7(String[] args) {
        int i = 1;
        int fac = 1;
        int sum = 0;
        while (i <= 5) {
            fac *= i;
            sum += fac;
            i++;
        }
        System.out.println(sum);
    }

    public static void main6(String[] args) {
        int i = 1;
        int sum = 0;
        while(i <= 5) {
            int a = 1;
            int fac = 1;
            while(a <= i) {
                fac *= a;
                a++;
            }
            sum += fac;
            i++;
        }
        System.out.println(sum);

    }
    //------------
    //编译器运行结果为
    //153

    public static void main5(String[] args) {
        int a = 1;
        int sum = 0;
        while (a <= 100) {
            sum += a;
            a++;
        }
        System.out.println("1-100和是" + sum);
        System.out.println("===========");
        a = 1;
        sum = 0;
        while(a <= 100) {
            sum += a;
            a += 2;
        }
        System.out.println("1-100奇数和为" + sum);
    }
    //-----------
    //编译器运行结果为
    //1-100和是5050
    //===========
    //    1-100奇数和为2500


    public static void main4(String[] args) {
        int a = 1;
        while (a <= 10) {
            System.out.println(a);
            a++;
        }
        System.out.println(123);

        System.out.println(456);
    }


    public static void main3(String[] args) {
        int day = 7;
        switch (day){
            case 1:
                System.out.println("星期一");
                break;
            case 2:
                System.out.println("星期二");
                break;
            case 3:
                System.out.println("星期三");
                break;
            case 4:
                System.out.println("星期四");
                break;
            case 5:
                System.out.println("星期五");
                break;
            case 6:
                System.out.println("星期六");
                break;
            case 7:
                System.out.println("星期七");
                break;
            default:
                System.out.println("输入错误");
                break;
        }
    }



    public static void main2(String[] args) {
        int n = 0;
        switch (n){
            case 1:
                System.out.println(1);
                break;
            case 2:
                System.out.println(2);
                break;
            default:
                System.out.println("输入错误");
                break;

        }
    }

    public static void main1(String[] args) {
        int num = 2020;
        if( num % 400 == 0 || num % 100 != 0 && num % 4 == 0){
            System.out.println(num + "是闰年" );
        }else{
            System.out.println(num + "不是闰年");
        }
    }
}
